import BaseService from '../BaseService'
import factory from '../serviceFactory'

class OrderService extends BaseService {
  /**
   * 出票单分页查询接口
   * queryIssueOrderPage()
   */
  queryIssueOrderPage = factory.makeGet('/api/order/queryIssueOrderPage')

  /**
   * 出票单详情接口
   * detailIssueOrder({localOrderId})
   */
  detailIssueOrder = factory.makeGet('/api/order/detailIssueOrder')

  /**
   * 订单日志查询接口
   * queryOrderLogList({localOrderId})
   */
  queryOrderLogList = factory.makeGet('/api/order/queryOrderLogList')

  /**
   * 订单状态统计接口
   * queryIssueOrderStatusNum()
   */
  queryIssueOrderStatusNum = factory.makeGet('/api/order/queryIssueOrderStatusNum')

  /**
   * 锁单接口
   * lockIssueOrder({localOrderId})
   */
  lockIssueOrder = factory.makePost('/api/order/lockIssueOrder')

  /**
   * 解锁接口
   * deblockingIssueOrder({localOrderId})
   */
  deblockingIssueOrder = factory.makePost('/api/order/deblockingIssueOrder')

  /**
   * 网店查询接口
   * queryAirOnlineShopList()
   */
  queryAirOnlineShopList = factory.makeGet('/api/order/queryAirOnlineShopList')

  /**
   * 订单信息修改（新增备注）
   * updateAirOrderRemark({localOrderId, remark})
   */
  updateAirOrderRemark = factory.makePost('/api/order/updateAirOrderRemark')

  /**
   * 更换PNR
   * changePnr({localOrderId})
   */
  changePnr = factory.makePost('/api/order/changePnr')

  /**
   * 保存订单
   */
  saveOrder = factory.makeJPost('/api/order/saveOrder')

  /**
   * 出票
   */
  drawTicket = factory.makeJPost('/api/order/drawTicket')

  /**
   * 已出票
   */
  finishTicket = factory.makeJPost('/api/order/finishTicket')

  /**
   * 出票失败
   */
  failedTicket = factory.makeJPost('/api/order/failedTicket')

  /**
   * 获取B2B运价信息
   * queryB2BPrice({airline, airlineRecordNo})
   */
  queryB2BPrice = factory.makeGet('/api/order/queryB2BPrice')

  /**
   * 获取B2B运价信息
   * queryBSPPatInfo({localOrderId, recordNo, etermGroup})
   */
  queryBSPPatInfo = factory.makeGet('/api/order/queryBSPPatInfo')

  /**
   * B2B出票
   * b2bIssue({...})
   */
  b2bIssue = factory.makePost('/api/order/b2bIssue')

  /**
   * BSP或BOP出票
   * etermIssue({...})
   */
  etermIssue = factory.makePost('/api/order/etermIssue')

  /**
   * B2B入库
   * b2bInput({localOrderId})
   */
  b2bInput = factory.makePost('/api/order/b2bInput')

  /**
   * 拆单
   * dismantleOrder()
   */
  dismantleOrder = factory.makeJPost('/api/order/dismantleOrder')

  /**
   * 占座或者换PNR
   * createPnr(...)
   */
  createPnr = factory.makeJPost('/api/order/createPnr')

  /**
   * 判读是否出票中
   * true ：出票中 false：不是出票中
   * checkIsOutStatus({localOrderId})
   */
  checkIsOutStatus = factory.makeGet('/api/order/checkIsOutStatus')

  /**
   * 补单（下一步）
   * supplementOrder({
       "type":"", --1.pnr导单，2.pnr文本解析，3-管理订单导入
       "pnrCode":"",  --pnrCode
       "pnrText":"",  ---pnr文本
       "localOrderId":"", --订单号
       "reason":"",   --原因
       "remarks":"" --备注
     })
   */
  supplementOrder = factory.makePost('/api/order/supplementOrder', {successW: false})

  /**
   * 补单-保存
   * supplementOrderSave()
   */
  supplementOrderSave = factory.makeJPost('/api/order/supplementOrderSave')

  /**
   * 保存备注
   * saveOrderRemark({localOrderId, content})
   */
  saveOrderRemark = factory.makePost('/api/order/saveOrderRemark')

  /**
   * 查询备注列表
   * queryOrderRemarkList({localOrderId})
   */
  queryOrderRemarkList = factory.makeGet('/api/order/queryOrderRemarkList')

  /**
   * 已解冻
   * thawOrder({localOrderId})
   */
  thawOrder = factory.makePost('/api/order/thawOrder')

  /**
   * 已解冻
   * orderMonitor({param})
   */
  orderMonitor = factory.makeGet('/api/order/orderMonitor')

  /**
   * 查询B2C账号列表
   * loadB2cAccount({airline})
   */
  loadB2cAccount = factory.makeGet('/api/order/loadB2cAccount')

  /**
   * 取消未出票的PNR
   * cancelPnrCheckIssued({localOrderId, pnr, remark})
   */
  cancelPnrCheckIssued = factory.makePost('/api/order/cancelPnrCheckIssued')
}

export default new OrderService()
